const notFound = ()=>import(/* webpackChunkName: "404" */"pages/404/404.vue")
const home = ()=>import(/* webpackChunkName: "home" */"pages/home/home.vue")
const shopcart = ()=>import(/* webpackChunkName: "shopcart" */"pages/shopcart/shopcart.vue")
const search = ()=>import(/* webpackChunkName: "search" */"pages/search/search.vue")
const register = ()=>import(/* webpackChunkName: "register" */"pages/register/register.vue")
const login = ()=>import(/* webpackChunkName: "login" */"pages/login/login.vue")
const detail = ()=>import(/* webpackChunkName: "detail" */"pages/detail/detail.vue")
const info = ()=>import(/* webpackChunkName: "info" */"pages/detail/info/info.vue")
const rule = ()=>import(/* webpackChunkName: "rule" */"pages/detail/rule/rule.vue")
const ratings = ()=>import(/* webpackChunkName: "ratings" */"pages/detail/ratings/ratings.vue")
const after = ()=>import(/* webpackChunkName: "after" */"pages/detail/after/after.vue")
const phone = ()=>import(/* webpackChunkName: "phone" */"pages/detail/phone/phone.vue")
const addtocart = ()=>import(/* webpackChunkName: "addtocart" */"pages/addtocart/addtocart.vue")
const center = ()=>import(/* webpackChunkName: "center" */"pages/center/center.vue")
const pay = ()=>import(/* webpackChunkName: "pay" */"pages/pay/pay.vue")
const paysuccess = ()=>import(/* webpackChunkName: "paysuccess" */"pages/paysuccess/paysuccess.vue")
const trade = ()=>import(/* webpackChunkName: "trade" */"pages/trade/trade.vue")
const myorder = ()=>import(/* webpackChunkName: "myorder" */"pages/center/myorder/myorder.vue")


const routes = [
  {
    name:"trade",
    path:"/trade",
    component:trade
  },
  {
    // name:"center",
    path:"/center",
    component:center,
    children:[
      {
        name:'myorder',
        path:"myorder",
        component:myorder
      },
      {
        path:"",
        redirect:"myorder"
      }
    ]
  },
  {
    name:"pay",
    path:"/pay",
    component:pay
  },
  {
    name:"paysuccess",
    path:"/paysuccess",
    component:paysuccess
  },
  {
    name:"addtocart",
    path:"/addtocart/:num",
    component:addtocart,
    props:true
  },
  {
    name:"detail",
    path:"/detail/:id",
    component:detail,
    props:true,
    children:[
      {name:"info",path:"info",component:info},
      {name:"rule",path:"rule",component:rule},
      {name:"ratings",path:"ratings",component:ratings},
      {name:"after",path:"after",component:after},
      {name:"phone",path:"phone",component:phone},
      {path:"",redirect:"info"}
    ]
  },
  {
    name:"home",
    path:"/home",
    component:home,
    meta:{
      showCategory:true
    }
  },
  {name:"shopcart",path:"/shopcart",component:shopcart},
  {
    name:"search",
    path:"/search/:keyword?",
    component:search,
    props:$route=>({
      keyword:$route.params.keyword,
      category1Id:$route.query.id1,
      category2Id:$route.query.id2,
      category3Id:$route.query.id3,
      categoryName:$route.query.categoryName
  })
    
  },
  {
    name:"register",
    path:"/register",
    component:register,
    meta:{
      hideFooter:true
    }
  },
  {
    name:"login",
    path:"/login",
    component:login,
    meta:{
      hideFooter:true
    }
  },
  {path:"/",redirect:"/home"},
  {
    name:"404",
    path:"/404",
    component:notFound
    
  },
  {path:"*",redirect:"/404"}

]

export default routes